package cn.wolfcode.service.impl;

import cn.wolfcode.domain.MessageBoard;
import cn.wolfcode.mapper.MessageBoardMapper;
import cn.wolfcode.qo.MessageBoardQuery;
import cn.wolfcode.service.IMessageBoardService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.Date;

@Service
public class MessageBoardServiceImpl extends ServiceImpl<MessageBoardMapper, MessageBoard> implements IMessageBoardService {
    @Override
    public IPage<MessageBoard> queryPage(MessageBoardQuery qo) {
        Page<MessageBoard> page = new Page<>(qo.getCurrentPage(),qo.getPageSize());
        return super.page(page);
    }

    @Override
    public void saveMessage(MessageBoard messageBoard) {
        messageBoard.setCreatime(new Date());
        super.save(messageBoard);
    }
}
